<template>
  <a-modal
    :title="title"
    :width="width"
    :visible="listModalVisible"
    :confirm-loading="false"
    @ok="handleCancel"
    @cancel="handleCancel"
    cancelText="关闭"
    wrapClassName="map_Show"
  >
    <a-tabs defaultActiveKey="1">
      <a-tab-pane tab="公示" key="1">
        <SmallAmountPublicityAccountListBingTu></SmallAmountPublicityAccountListBingTu>
      </a-tab-pane>
      <a-tab-pane tab="推荐" key="2">
        <SmallRecommendationAccountListBingTu></SmallRecommendationAccountListBingTu>
      </a-tab-pane>
      <a-tab-pane tab="放款" key="3">
        <SmallLoanAccountListBingTu></SmallLoanAccountListBingTu>
      </a-tab-pane>
    </a-tabs>
  </a-modal>
</template>
<script>
    import {JeecgListMixin} from '@/mixins/JeecgListMixin'
    import {initDictOptions, filterMultiDictText} from '@/components/dict/JDictSelectUtil'
    import {filterObj} from '@/utils/util';
    import SmallRecommendationAccountListBingTu from "./SmallRecommendationAccountListBingTu";
    import SmallAmountPublicityAccountListBingTu from "./SmallAmountPublicityAccountListBingTu";
    import SmallLoanAccountListBingTu from "./SmallLoanAccountListBingTu";
    import JEllipsis from "../../../components/jeecg/JEllipsis";

    export default {
        name: "JinRongFuWuBingTu",
        mixins: [JeecgListMixin],
        components: {
            JEllipsis,
            SmallLoanAccountListBingTu,
            SmallAmountPublicityAccountListBingTu,
            SmallRecommendationAccountListBingTu,
        },
        data() {
            return {
                title: "台账管理",
                listModalVisible: false,
                width: 1500,
                visible: false,
                description: '台账管理页面',
                // 表头
                columns: [
                    {
                        title: '#',
                        dataIndex: '',
                        key: 'rowIndex',
                        width: 60,
                        align: "center",
                        customRender: function (t, r, index) {
                            return parseInt(index) + 1;
                        }
                    },
                    {
                        title: '户主姓名',
                        align: "center",
                        dataIndex: 'loanName'
                    },
                    {
                        title: '乡镇',
                        align: "center",
                        dataIndex: 'fwzId',
                        customRender: (text) => {
                            if (!text) {
                                return ''
                            } else {
                                return filterMultiDictText(this.dictOptions['fwzId'], text + "")
                            }
                        }
                    },
                    {
                        title: '性别',
                        align: "center",
                        dataIndex: 'sex',
                        customRender: (text) => {
                            if (!text) {
                                return ''
                            } else {
                                return filterMultiDictText(this.dictOptions['sex'], text + "")
                            }
                        }
                    },
                    {
                        title: '年龄',
                        align: "center",
                        dataIndex: 'age'
                    },
                    {
                        title: '家庭住址',
                        align: "center",
                        dataIndex: 'address'
                    },
                    {
                        title: '信用评分',
                        align: "center",
                        dataIndex: 'creditScore'
                    },
                    {
                        title: '信用等级',
                        align: "center",
                        dataIndex: 'creditRating',
                        customRender: (text) => {
                            if (!text) {
                                return ''
                            } else {
                                return filterMultiDictText(this.dictOptions['creditRating'], text + "")
                            }
                        }
                    },
                    {
                        title: '借款金额（万元）',
                        align: "center",
                        dataIndex: 'loanMoney'
                    },
                    {
                        title: '借款用途',
                        align: "center",
                        dataIndex: 'loanUse'
                    },
                    {
                        title: '批次',
                        align: "center",
                        dataIndex: 'batch'
                    },
                    {
                        title: '公示时间',
                        align: "center",
                        dataIndex: 'dateGs',
                        customRender: function (text) {
                            return !text ? "" : (text.length > 10 ? text.substr(0, 10) : text)
                        }
                    },
                    {
                        title: '操作',
                        dataIndex: 'action',
                        align: "center",
                        scopedSlots: {customRender: 'action'},
                    }
                ],
                url: {
                    list: "/loanmanagement/smallAmountPublicityAccount/list",
                    delete: "/loanmanagement/smallAmountPublicityAccount/delete",
                    deleteBatch: "/loanmanagement/smallAmountPublicityAccount/deleteBatch",
                    exportXlsUrl: "/loanmanagement/smallAmountPublicityAccount/exportXls",
                    importExcelUrl: "loanmanagement/smallAmountPublicityAccount/importExcel",
                },
                dictOptions: {
                    sex: []
                }
            }
        },
        computed: {
            importExcelUrl: function () {
                return `${window._CONFIG['domianURL']}/${this.url.importExcelUrl}`;
            }
        },
        methods: {
            showGoodsGallery(record) {
                this.loadData(1);
                this.id = record.id;
                this.listModalVisible = true
            },
            handleCancel() {
                this.listModalVisible = false;
            },
            getQueryParams() {
                //获取查询条件
                let sqp = {}
                if (this.superQueryParams) {
                    sqp['superQueryParams'] = encodeURI(this.superQueryParams)
                }
                var param = Object.assign(sqp, this.queryParam, this.isorter, this.filters);
                param.field = this.getQueryField();
                param.pageNo = this.ipagination.current;
                param.pageSize = this.ipagination.pageSize;

                if (param.loanUse != undefined) {
                    param.loanUse = "*" + param.loanUse + "*";
                }
                if (param.loanName != undefined) {
                    param.loanName = "*" + param.loanName + "*";
                }
                return filterObj(param);
            },
            initDictConfig() {
                initDictOptions('sex').then((res) => {
                    if (res.success) {
                        this.$set(this.dictOptions, 'sex', res.result)
                    }
                })
                initDictOptions('tb_jrtx_fwz,township_name,id').then((res) => {
                    if (res.success) {
                        this.$set(this.dictOptions, 'fwzId', res.result)
                    }
                })
                initDictOptions('credit_rating').then((res) => {
                    if (res.success) {
                        this.$set(this.dictOptions, 'creditRating', res.result)
                    }
                })
            }

        }
    }
</script>
<style scoped>
  @import '~@assets/less/common.less'
</style>